//
//  UILabel+ResolveNull.m
//  BaxTer
//
//  Created by wsj2015 on 2016/11/2.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "UILabel+ResolveNull.h"

static const char *key = "wsj_text";
@implementation UILabel (ResolveNull)


- (NSString *)wsj_text{
    
    return objc_getAssociatedObject(self, key);
}


- (void)setWsj_text:(NSString *)wsj_text{
   
    objc_setAssociatedObject(self, key, wsj_text, OBJC_ASSOCIATION_COPY_NONATOMIC);
    if ([wsj_text isKindOfClass:[NSNull class]] || !wsj_text) {
        self.text = @"0";
    }else{
      self.text = wsj_text;
    }
    
    if ([wsj_text rangeOfString:@"(null)"].length) {
        self.text = [wsj_text stringByReplacingOccurrencesOfString:@"(null)" withString:@"0"];
        
    }
    
}
@end
